package com.java.dao.Impl;

import com.java.dao.addFlight;
import com.java.entity.FlightInformation;
import com.java.util.C3P0Util;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

public class addFlightImpl implements addFlight {
    QueryRunner qr=new QueryRunner(C3P0Util.getDataSource());
    @Override
    public int addFlight(FlightInformation flightinf) throws SQLException {
        String sql="insert into f_flightInformation values(?,?,?,?,?,?,?,?,?)";
        Object[] obj={flightinf.getFlightNo(),flightinf.getAirlineNo(),flightinf.getOrigin(),flightinf.getDestination(),
                flightinf.getLeaveTime(),flightinf.getArriveTime(),flightinf.getTotalSeats(),flightinf.getPrice(),flightinf.getDistance()};
        return  qr.update(sql,obj);
    }
}
